const webpack = require('webpack')
module.exports = {
  outputDir: process.env.NODE_ENV === 'development' ? 'dist' : 'dist',
  indexPath: 'index.html',
  publicPath: process.env.NODE_ENV === 'development' ? './' : './',
  assetsDir: process.env.NODE_ENV === 'development' ? 'static' : 'static',
  lintOnSave: true,
  devServer: {
    // 解决内网穿透
    disableHostCheck: true,
    overlay: {
      warnings: true,
      errors: true
    },
    open: true,
    port: '8090',
    https: false,
    hotOnly: false,
    proxy: {
      '/app1_v1': { // 应用1_开发
        target: 'http://192.168.1.169:9990/',
        pathRewrite: {
          '^/app1_v1': '/'
        },
        changeOrigin: true
      },
      '/app1_v2': { // 应用2_测试
        target: 'http://192.168.1.169:9991/',
        pathRewrite: {
          '^/app1_v2': '/'
        },
        changeOrigin: true
      },
      '/app2_v1': { // 应用2_接口1
        target: 'http://192.168.1.212:9991/',
        pathRewrite: {
          '^/app2_v1': '/'
        },
        changeOrigin: true
      }
    }
  },
  transpileDependencies: [
    'vuetify'
  ],
  chainWebpack: config => {
    config.plugin('html')
      .tap(args => {
        args[0].title = 'Loading'
        return args
      })
  },
  configureWebpack: {
    plugins: [
      new webpack.ProvidePlugin({
        $: 'jquery',
        jQuery: 'jquery',
        'windows.jQuery': 'jquery'
      })
    ]
  }
}
